fix(web): scope Composer drafts to Sessions - #480
Conversation
28bee59 to
180892f
Compare
tt-a1i
left a comment
There was a problem hiding this comment.
Reviewed at exact head 180892f.
Standards
[P1] Draft ownership prefers selectedPath whenever it is non-null, but setWorkspace() enables a workspace draft without clearing the previous Session path. Switching from Session A to a new draft in workspace B therefore keeps A’s scope and unsent text visible in B, where it can be submitted to the wrong repository. Draft mode must prefer new:${selectedWorkspace} or the store must atomically clear selectedPath; add an active-A → workspace-B regression.
Spec
[P1] Manual new-Session creation loses an unsent workspace draft. Transfer is allowed only when pendingSubmission exists; if the user types a workspace draft and clicks New Session before submitting, the path changes and the normal scope-change effect clears the draft. Add explicit transfer semantics and a manual-creation test.
[P2] A second Enter while admission is pending replaces pendingSubmission.current before the store rejects the duplicate. When the original send succeeds, its identity no longer matches and the already-sent text remains available for accidental resend. Guard the UI send path while pending or preserve the original pending identity, with a rapid double-Enter test.
Focused tests and bundle parity pass, but the requested real-browser delayed-network path is not covered.
Problem
Web Composer drafts are local to the component instead of the selected Session. Switching Sessions can show the previous Session's draft, and a late successful send receipt clears newer text typed after the send. Fixes #457.
Value
Users no longer lose new input when a send settles late, and drafts from one Session cannot appear in another Session. Failed sends remain editable.
Approach
Validation
bunx vitest run tests/web/app-render.spec.ts— 17 passed.bun run check— passed.git diff --check— passed.bun run test— run; two unrelated existing/environment-sensitive failures remain: the Windows Git process test reports-1instead of7, and the detached launch-card repaint test fails. The focused Web Composer suite passes.Impact